from lib.anki import generate_anki_import_file
from lib.my_tts import gen_audio_by_bytedance
from lib.my_pic_searcher.my_pic_searcher import get_img_by_en_from_pexels
from lib.my_pic_searcher.my_pic_searcher import get_img_only_by_en_from_pexels
from lib.my_translator.my_translator import translate_ch_to_en
import os
import string


# def test_generate_anki_import_file_basic():
#     """测试正常卡片生成"""
#     print("Running test_generate_anki_import_file_basic")
#     test_cards = [
#         {"Front": "Hello", "Back": "你好"},
#         {"Front": "Goodbye", "Back": "再见"}
#     ]
#     output_file = "output/test_output.txt"
    
#     generate_anki_import_file(test_cards, "TestDeck", output_file)

# test_generate_anki_import_file_basic()

cards = []
snd_txts = ['拼音de']

letter_groups = [
    ['a', 'o', 'e'],
    ['i', 'u', 'ü']
]

# for grp in letter_groups:
    # for letter in grp:
        # card = {}
        # card['front'] = '[sound:' + letter + '.mp3]'
        # card['back'] = '<font size="10">' + letter + '</font>'
        # cards.append(card)
    # grp_name = str(i) + '_' + grp[1] + '~' + grp[3]
    # generate_anki_import_file(cards, "All::徐韬略::幼儿园::中班下学期::英文字母::2_写::" + grp_name, 'output/anki_import_data_' + grp_name + '.txt')

# print(snd_txts)

if False:
    for snd_txt in snd_txts:
        gen_audio_by_bytedance(snd_txt, 'output/' + snd_txt + '.mp3')

# get_img_by_en_from_pexels(['jump'])
#print(translate_ch_to_en('我'))

# cn_words = ( \
# '果汁', '橙子', \
# '酸奶', '甜甜圈', '奇异果', \
# )
# pair_words = []
# for cn_word in cn_words:
#     en_word = translate_ch_to_en(cn_word)
#     print(cn_word + ': ' + en_word)
#     pair_words.append({'cn_word': cn_word, 'en_word': en_word})

# get_img_by_en_from_pexels(pair_words, 'output')

en_words = ("snail", "lion", "crab")

get_img_only_by_en_from_pexels(en_words, "output")